<template>
  <div>
    <li><router-link to="/contacts/all">All contacts</router-link></li>
    <li><router-link to="/contacts/alice">Alice</router-link></li>
    <li><router-link to="/contacts/bob">Bob</router-link></li>
    <button @click="fn">随机显示</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "ShouYe",
  components: {},
  props: {},
  data() {
    return {
      arr: ["all", "alice", "bob"],
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    fn() {
      this.$router.push(`/contacts/${this.arr[Math.floor(Math.random() * 3)]}`);
    },
  },
};
</script>

<style scoped>
.router-link-active {
  color: #fd3b3d;
}
</style>
